home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows2 / hp22d3.zip / REFGUIDE / COLORS.TXT < prev    next >
Text File  |  1991-05-16  |  5KB  |  132 lines

  1.  
  2.  
  3.  
  4.  
  5.     ________________________________________________________________________
  6.                                                   Chapter 9: Colors   69
  7.     ________________________________________________________________________
  8.  
  9.  
  10.     CHAPTER NINE:  COLORS
  11.  
  12.     Some PADtalk properties and commands require that you specify a color.
  13.     Traditionally on personal computers, colors are represented by a
  14.     foreground color and a background color combination, or attribute. There
  15.     are always 256 attributes available in character mode, but these are
  16.     translated by some hardware systems to black and white. Colors 0 to 127
  17.     are normal intensity combinations, and colors 128 to 255 are high
  18.     intensity combinations.
  19.  
  20.     There are 16 possible colors, each corresponding to a number. Each color
  21.     can be used as a background or foreground (16*16=256).
  22.  
  23.     0     black                  8     dark grey
  24.  
  25.     1     blue                   9     light blue
  26.  
  27.     2     green                  10    light green
  28.  
  29.     3     cyan                   11    light cyan
  30.  
  31.     4     red                    12    light red
  32.  
  33.     5     magenta                13    light magenta
  34.  
  35.     6     brown                  14    light brown
  36.  
  37.     7     grey                   15    white
  38.  
  39.  
  40.     SPECIFYING COLORS
  41.  
  42.     The color names from this table can be used to specify a color in an
  43.     English-like manner, as in the following example:
  44.  
  45.     set the fillColor of button 1 to red;
  46.  
  47.     set the acceleratorColor of pg btn "help" to light red;
  48.  
  49.     put yellow into myColor;
  50.  
  51.     You can combine the color keywords using the word on to form a
  52.     foreground/background attribute specification. When no background is
  53.     specified, black is assumed. The syntax for such a combination is as
  54.     follows:
  55.  
  56.     <foreground color> on <background color>
  57.  
  58.  
  59.  
  60.     ________________________________________________________________________
  61.                                                   Chapter 9: Colors   70
  62.     ________________________________________________________________________
  63.  
  64.  
  65.     For example, the following statement sets the fill color of button 1 to
  66.     be light blue background with red lettering.
  67.  
  68.     set the fillColor of button 1 to red on light blue;
  69.  
  70.  
  71.     COLOR NUMBERS
  72.  
  73.     The color constants are translated by HyperPAD to single numbers between
  74.     0 and 255 using the following formula:
  75.  
  76.        color = (background * 16) + foreground
  77.  
  78.     For example, the color red on white translates to:
  79.  
  80.        color = (white * 16) + red
  81.        color = (15 * 16) + 4c
  82.        color = 244
  83.  
  84.     Thus, the following two statements are equivalent:
  85.  
  86.     set the fillColor of button 1 to red on white;
  87.     set the fillColor of button 1 to 244;
  88.  
  89.     Representing colors as numbers allows you to algorithmically adjust the
  90.     colors of objects, as in the following example:
  91.  
  92.     -- ask for the foreground color number
  93.     ask "type in foreground color number";
  94.     put it into fcolor;
  95.  
  96.     -- ask for the background color number
  97.     ask "type in background color number";
  98.     put in into bcolor;
  99.  
  100.     -- set the color
  101.     set the color of page field 1 to (bcolor * 16) + fcolor;
  102.  
  103.     The colors available are determined by the graphics card and monitor
  104.     used. The color constants 0 through 7 are low intensity, whereas colors
  105.     8 through 15 are high intensity. On some monitors, you may need to
  106.     finely adjust the contrast to see the high intensity colors.
  107.  
  108.     Using a high intensity color as a background is blinking on most
  109.     hardware configurations. HyperPAD disables this blinking capability to
  110.     provide you with the maximum number of color combinations (256). You can
  111.     specify the higher intensity colors using the word blinking:
  112.  
  113.     set the color of button 1 to blinking grey on red;
  114.  
  115.  
  116.  
  117.     ________________________________________________________________________
  118.                                                   Chapter 9: Colors   71
  119.     ________________________________________________________________________
  120.  
  121.  
  122.     When you design pads for monochrome systems, all of the 256 available
  123.     colors are translated to black and white. In general, it is safe to use
  124.     the following color combinations:
  125.  
  126.        color 7 (grey)              white on black
  127.        color 112 (black on grey)   reverse video
  128.  
  129.     These are the default colors for all objects.
  130.  
  131.     On LCD systems, such as some laptops, the color combinations may be
  132.     different.